import { main } from './main';

let lock = false;
let count = 10000;
let end = 20000;

function run() {
  lock = false;
  main(() => {
    let root = 'https://ygo.res.netease.com/pc/gw/cards/';
    let arr = [];
    for (let i = count; i < count + 1000; i++) {
      arr.push(root + i + '.jpg');
    }
    count = count + 1000;
    return arr;
  }).then(() => {
    console.log(`${count - 1000}到${count}isOkk`);
  }).finally(() => {
    lock = true;
  });
}

run();
const clc = setInterval(() => {
  if (count >= end) {
    clearInterval(clc);
  }
  if (lock && count < end) {
    run();
  }
}, 10000);
